package com.miao.common.service;

import com.miao.common.entity.Message;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author MiaoWenqing
 * @description: 聊天服务层 接口
 * @date 2021/2/4 15:01
 */
@Service
public interface ChatService {

    /**
     * 获取 聊天记录
     * @param uid 用户id
     * @param storeId 店铺id
     * @return List
     */
    List<Message> getMessageRecord(String uid,String storeId);

    /**
     * 存储消息
     * @param message 消息对象
     * @return R
     */
    boolean saveMessageRecord(Message message);

    /**
     * 创建会话
     * @param waiterId 客服id
     * @param uid 顾客id
     */
    void creatSession(String storeId, String uid,String waiterId);


    /**
     * 关闭会话
     * @param waiterId 客服id
     * @param uid 顾客id
     */
    void closeSession(String waiterId,String uid);

    /**
     * 客服上线
     * @param storeId 店铺id
     * @param waiterId 客服id
     */
    void onlineWaiter(String storeId ,String waiterId);
    /**
     * 客服下线
     * @param storeId 店铺id
     * @param waiterId 客服id
     */
    void outlineWaiter(String storeId ,String waiterId);


    /**
     * 客户加入等待队列
     * @param storeId 店铺id
     * @param uid 客户id
     */
    void pushWaitQueue(String storeId, String uid);

    /**
     * 客户出等待队列
     * @param storeId 店铺id
     * @param uid 客户
     */
    void popWaitQueue(String storeId, String uid);

    /**
     * 店铺全部等待用户
     * @param storeId 店铺id
     * @return list
     */
    List<Object> waitQueue(String storeId);


    /**
     * 随机匹配客服
     * @param storeId 店铺ID
     * @return int
     */
    long matchWaiter(String storeId );

    /**
     * 获取客服id
     * @return  id
     */
   String getWaiterId(String storeId ,long index);


    /**
     * 机器人客服
      * @param context 消息内容
     * @return 回答语句
     */
    String robotWaiter(String context);




}
